<?php
$queries[] = "CREATE TABLE `".$pre."_adminRights` (
  `id` int(10) NOT NULL auto_increment,
  `rightName` varchar(50) NOT NULL,
  `rightOutput` varchar(100) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;";

$queries[] = "INSERT INTO `".$pre."_adminRights` (`id`, `rightName`, `rightOutput`) VALUES
(1, 'canEditNavigation', 'Navigation bearbeiten?'),
(2, 'canEditSettings', 'Einstellungen bearbeiten'),
(3, 'canMaintain', 'Darf Datenbank-Wartung/Backup?'),
(4, 'canManageErrors', 'Darf die Fehlermeldungen sehen?'),
(5, 'canManageStyles', 'Darf Style &auml;ndern?'),
(6, 'canManageBBCode', 'Darf BBCode bearbeiten?'),
(7, 'canManageSmilies', 'Darf Smilies bearbeiten?'),
(8, 'canManageModules', 'Darf Module managen?'),
(9, 'canManageBadwords', 'Darf Badwords bearbeiten?'),
(10, 'canManagePages', 'Darf Seiten bearbeiten?'),
(11, 'canManageComments', 'Darf Kommentare bearbeiten?'),
(12, 'canManageContent', 'Darf Content-Erweiterungen bearbeiten?');";

$queries[] = "CREATE TABLE `".$pre."_admins` (
  `id` tinyint(5) NOT NULL auto_increment,
  `adminName` varchar(60) NOT NULL,
  `adminPassword` varchar(50) NOT NULL,
  `adminEmail` varchar(70) NOT NULL,
  `adminSession` varchar(50) NOT NULL,
  `adminFounder` tinyint(1) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;";

// Add ADMIN
$queries[] = "INSERT INTO `".$pre."_admins` (`id`, `adminName`, `adminPassword`, `adminEmail`, `adminSession`, `adminFounder`) VALUES
(1, '".DB::parseVar($_POST['username'])."', '".sha1(DB::parseVar($_POST['username']).$_POST['password'])."', '".DB::parseVar($_POST['email'])."', '', 0);";

$queries[] = "CREATE TABLE `".$pre."_allowedExtensions` (
  `id` int(10) NOT NULL auto_increment,
  `file` varchar(60) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;";

$queries[] = "INSERT INTO `".$pre."_allowedExtensions` (`id`, `file`) VALUES
(1, 'ImageHandler.php'),
(2, 'MovieHandler.php');";

$queries[] = "CREATE TABLE `".$pre."_badwords` (
  `id` int(10) NOT NULL auto_increment,
  `badInput` varchar(100) NOT NULL,
  `badReplace` varchar(100) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;";

$queries[] = "INSERT INTO `".$pre."_badwords` (`id`, `badInput`, `badReplace`) VALUES
(1, 'fuck', '****'),
(2, 'arsch', 'hintern');";

$queries[] = "CREATE TABLE `".$pre."_bbcode` (
  `id` int(8) NOT NULL auto_increment,
  `bbcodeInput` text NOT NULL,
  `bbcodeReplace` text NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;";


$queries[] = "INSERT INTO `".$pre."_bbcode` (`id`, `bbcodeInput`, `bbcodeReplace`) VALUES
(1, '[b]%b[/b]', '<b>%b</b>'),
(2, '[i]%i[/i]', '<i>%i</i>'),
(3, '[quote]%q[/quote]', '<table class=\"content\" style=\"width: 90%;margin:10px;\"><tr><td class=\"bbcode_head\"><b>Quote:</b></td></tr><tr><td class=\"bbcode_bg\"><p style=\"font-size:11px;\">%q</p></td></tr></table>'),
(5, '[u]%u[/u]', '<u>%u</u>'),
(6, '[s]%s[/s]', '<s>%s</s>'),
(7, '[url=%s]%l[/url]', '<a href=\"%s\">%l</a>'),
(8, '[url]%s[/url]', '<a href=\"%s\">%s</a>'),
(9, '[email=%s]%l[/email]', '<a href=\"mailto:%s\">%l</a>'),
(10, '[img]%s[/img]', ' 	<img src=\"%s\" alt=\"Image\" border=\"0\" />'),
(11, '[ul]%u[/ul]', '<ul>%u</ul>'),
(12, '[li]%u[/li]', '<li>%u</li>'),
(13, '[align=%a]%b[/align]', '<span style=\"text-align:%a;\">%b</span>'),
(14, '[color=%a]%b[/color]', '<span style=\"color:%a;\">%b</span>'),
(15, '[size=%a]%b[/size]', ' 	<span style=\"font-size:%apx;\">%b</span>'),
(16, '[youtube]%y[/youtube]', '<object width=\"560\" height=\"340\"><param name=\"movie\" value=\"http://www.youtube.com/v/%y&hl=de&fs=1\"></param><param name=\"allowFullScreen\" value=\"true\"></param><param name=\"allowscriptaccess\" value=\"always\"></param><embed src=\"http://www.youtube.com/v/%y&hl=de&fs=1\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"560\" height=\"340\"></embed></object>'),
(18, '[---]', '<hr />');";


$queries[] = "CREATE TABLE `".$pre."_comments` (
  `id` int(11) NOT NULL auto_increment,
  `comConId` int(11) NOT NULL,
  `comPage` varchar(30) NOT NULL,
  `comTitle` varchar(50) NOT NULL,
  `comText` text NOT NULL,
  `comAuthor` varchar(50) NOT NULL,
  `comAuthorEmail` varchar(60) NOT NULL,
  `comDate` int(15) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;";


$queries[] = "CREATE TABLE `".$pre."_error` (
  `errorid` int(11) NOT NULL auto_increment,
  `errorName` varchar(70) NOT NULL,
  `errorText` text NOT NULL,
  `errorDate` int(15) NOT NULL,
  `errorArt` varchar(50) NOT NULL,
  PRIMARY KEY  (`errorid`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;";


$queries[] = "CREATE TABLE `".$pre."_ipLock` (
  `id` int(10) NOT NULL auto_increment,
  `lockPage` varchar(30) NOT NULL,
  `lockIp` varchar(20) NOT NULL,
  `lockDate` int(15) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;";


$queries[] = "CREATE TABLE `".$pre."_modules` (
  `id` int(11) NOT NULL auto_increment,
  `moduleName` varchar(70) NOT NULL,
  `moduleFolder` varchar(60) NOT NULL,
  `moduleDescription` text NOT NULL,
  `moduleClass` varchar(60) NOT NULL,
  `moduleAuthor` varchar(60) NOT NULL,
  `moduleAuthorURL` varchar(70) NOT NULL,
  `moduleEnabled` tinyint(1) NOT NULL,
  `moduleInstallDate` int(15) NOT NULL,
  `moduleVersion` varchar(10) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;";


$queries[] = "CREATE TABLE `".$pre."_navigations` (
  `id` int(5) NOT NULL auto_increment,
  `naviName` varchar(60) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;";


$queries[] = "INSERT INTO `".$pre."_navigations` (`id`, `naviName`) VALUES
(1, 'Linke Navigation'),
(2, 'Rechte Navigation');";


$queries[] = "CREATE TABLE `".$pre."_navigationsCat` (
  `id` int(10) NOT NULL auto_increment,
  `naviId` int(10) NOT NULL,
  `catName` varchar(50) NOT NULL,
  `catShow` tinyint(1) NOT NULL,
  `catShowTab` varchar(50) NOT NULL,
  `catOnlyAdmin` tinyint(1) NOT NULL,
  `orderId` int(5) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;";


$queries[] = "INSERT INTO `".$pre."_navigationsCat` (`id`, `naviId`, `catName`, `catShow`, `catShowTab`, `catOnlyAdmin`, `orderId`) VALUES
(1, 1, 'Home', 0, '', 1, 0),
(2, 1, '2. Kategorie', 0, '', 1, 1),
(3, 1, 'Suche', 0, '', 1, 2),
(4, 2, 'Test', 0, '', 1, 0),
(5, 2, 'Nur für Admins', 0, '', 0, 1),
(6, 2, 'Styleswitcher', 0, '', 1, 2);";


$queries[] = "CREATE TABLE `".$pre."_navigationsLinks` (
  `id` int(10) NOT NULL auto_increment,
  `linkCatId` int(10) NOT NULL,
  `linkName` varchar(60) NOT NULL,
  `linkURL` varchar(60) NOT NULL,
  `linkTemplate` varchar(100) NOT NULL,
  `linkHTML` text NOT NULL,
  `linkShow` tinyint(1) NOT NULL,
  `linkTab` tinyint(1) NOT NULL,
  `linkOnlyAdmin` tinyint(1) NOT NULL,
  `orderId` int(10) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;";


$searchurl = ($_POST['useModRewrite'] == "0") ? "search/":"?page=search";
$adminlogin = ($_POST['useModRewrite'] == "0") ? "adminLogin/":"?page=adminLogin";
$queries[] = "INSERT INTO `".$pre."_navigationsLinks` (`id`, `linkCatId`, `linkName`, `linkURL`, `linkTemplate`, `linkHTML`, `linkShow`, `linkTab`, `linkOnlyAdmin`, `orderId`) VALUES
(1, 1, 'Home', 'index.php', '', '', 0, 1, 1, 0),
(2, 1, 'LD-Host', 'http://www.ld-host.de', '', '', 0, 1, 1, 1),
(3, 1, 'LD-Network', 'http://ld-network.de', '', '', 0, 1, 1, 2),

(5, 2, 'Home', 'index.php', '', '', 0, 0, 1, 0),

(4, 3, 'Suche', '', 'naviTemplates/search.php', '', 0, 1, 1, 0),

(6, 4, 'Suche', '".$searchurl."', '', '', 0, 1, 1, 0),
(7, 4, 'Adminlogin', '".$adminlogin."', '', '', 0, 1, 1, 1),



(8, 5, 'htmlTest', '', '', '<a href=\"#\"><b>Linktest</b></a>', 0, 1, 1, 0),

(9, 6, 'Styleswitcher', '', 'naviTemplates/styleChanger.php', '', 0, 1, 1, 0);";


$queries[] = "CREATE TABLE `".$pre."_pageBox` (
  `id` int(10) NOT NULL auto_increment,
  `pageId` int(10) NOT NULL,
  `boxName` varchar(50) NOT NULL,
  `orderId` int(10) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;";


$queries[] = "INSERT INTO `".$pre."_pageBox` (`id`, `pageId`, `boxName`, `orderId`) VALUES
(1, 1, 'Hallo', 1),
(2, 1, 'Suche', 2);";



$queries[] = "CREATE TABLE `".$pre."_pageBoxContent` (
  `id` int(10) NOT NULL auto_increment,
  `boxId` int(10) NOT NULL,
  `conTitle` varchar(60) NOT NULL,
  `conText` text NOT NULL,
  `conFile` varchar(70) NOT NULL,
  `conFileGetvars` varchar(100) NOT NULL,
  `orderId` int(10) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;";


$queries[] = "INSERT INTO `".$pre."_pageBoxContent` (`id`, `boxId`, `conTitle`, `conText`, `conFile`, `conFileGetvars`, `orderId`) VALUES
(1, 1, 'Herzlich Willkommen', 'Das LD-CMS3 wurde erfolgreich installiert!', '', '', 0),
(2, 1, '2. Box', 'Man kann auch 2 Boxen nebeneinander packen', '', '', 1),
(3, 2, '', '', 'search.php', '', 0);";


$queries[] = "CREATE TABLE `".$pre."_pageLinks` (
  `id` int(11) NOT NULL auto_increment,
  `linkConnectionId` varchar(20) NOT NULL,
  `linkName` varchar(70) NOT NULL,
  `linkFile` varchar(70) NOT NULL,
  `linkGetParameters` varchar(70) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;";


$queries[] = "INSERT INTO `".$pre."_pageLinks` (`id`, `linkConnectionId`, `linkName`, `linkFile`, `linkGetParameters`) VALUES
(1, '', 'Adminlogin', 'admin/adminLogin.php', ''),
(33, '', 'Suche', 'search.php', '');";


$queries[] = "CREATE TABLE `".$pre."_pages` (
  `id` int(10) NOT NULL auto_increment,
  `pageName` varchar(50) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;";


$queries[] = "INSERT INTO `".$pre."_pages` (`id`, `pageName`) VALUES
(1, 'Home');";


$queries[] = "CREATE TABLE `".$pre."_predefinedLinks` (
  `id` int(10) NOT NULL auto_increment,
  `preConnectionId` varchar(50) NOT NULL,
  `preName` varchar(70) NOT NULL,
  `preLinkNoModRewrite` varchar(150) NOT NULL,
  `preLinkModRewrite` varchar(50) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;";


$queries[] = "INSERT INTO `".$pre."_predefinedLinks` (`id`, `preConnectionId`, `preName`, `preLinkNoModRewrite`, `preLinkModRewrite`) VALUES
(1, '', 'Startseite', 'index.php', '/'),
(2, '', 'Adminlogin', '?page=adminLogin', 'adminLogin/'),
(54, '', 'Suche', '?page=search', 'search/');";


$queries[] = "CREATE TABLE `".$pre."_rightToAdmin` (
  `id` int(10) NOT NULL auto_increment,
  `adminId` int(10) NOT NULL,
  `rightId` int(10) NOT NULL,
  `value` tinyint(1) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;";


$queries[] = "CREATE TABLE `".$pre."_settings` (
  `id` int(11) NOT NULL auto_increment,
  `setName` varchar(60) NOT NULL,
  `setValue` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;";


$queries[] = "CREATE TABLE `".$pre."_settingsText` (
  `id` int(11) NOT NULL auto_increment,
  `setName` varchar(60) NOT NULL,
  `setValue` text NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;";


$queries[] = "INSERT INTO `".$pre."_settings` (`id`, `setName`, `setValue`) VALUES
(1, 'general.pageTitle', '".DB::parseVar($_POST['title'])."'),
(2, 'general.defaultStyle', 'standard'),
(3, 'general.pageSlogan', '".DB::parseVar($_POST['slogan'])."'),
(4, 'general.footerText', '&copy; by LD-Network.de'),
(5, 'general.useModRewrite', '".DB::parseVar($_POST['useModRewrite'])."'),
(6, 'meta.Author', 'Dennis Franke'),
(7, 'meta.Publisher', 'Dennis Franke'),
(8, 'meta.Copyright', 'Dennis Franke'),
(9, 'meta.Description', 'Das LD-CMS3 von LD-Network.de'),
(10, 'meta.Keywords', 'LD-CMS3,LD-Network,ld,dennis,ljungi,CMS,Script'),
(11, 'meta.Category', 'Programmieren'),
(12, 'meta.Type', 'CMS'),
(13, 'meta.Audience', 'Programierer'),
(14, 'meta.Robots', 'noindex,nofollow'),
(15, 'general.pageOnline', '0'),
(16, 'general.offlineExplanation', ''),
(17, 'general.ipLockLength', '60'),
(18, 'pages.defaultPage', '1'),
(19, 'search.quickSearchLimit', '5'),
(20, 'search.resultsPerPage', '10'),
(21, 'search.useQuickSearch', '0'),
(22, 'search.quickMinChar', '4');";


$queries[] = "CREATE TABLE `".$pre."_smilies` (
  `id` int(10) NOT NULL auto_increment,
  `smilieInput` varchar(60) NOT NULL,
  `smilieFile` varchar(60) NOT NULL,
  `smilieDisplay` tinyint(1) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;";


$queries[] = "INSERT INTO `".$pre."_smilies` (`id`, `smilieInput`, `smilieFile`, `smilieDisplay`) VALUES
(1, ':D', 'bigsmile.gif', 0),
(2, ':S', 'confused.gif', 0),
(9, ':cool:', 'cool.gif', 0),
(8, 'oO', 'eek.gif', 0),
(10, '''(', 'cry.gif', 0),
(11, ':!:', 'exclaim.gif', 0),
(12, 'xD', 'gigagrossessmile.gif', 0),
(13, ':arrow:', 'icon_arrow.gif', 0),
(14, ':idea:', 'idea.gif', 0),
(15, ':nana:', 'nana.gif', 0),
(16, ':question:', 'question.gif', 0),
(17, ':mad:', 'mad.gif', 0),
(18, ':shy:', 'redface.gif', 0),
(19, ':P', 'zunge.gif', 0),
(20, ':devil:', 'sauer.gif', 0),
(21, ':rock:', 'rock.gif', 1),
(22, ':)', 'smile.gif', 0);";
?>